#include<bits/stdc++.h>
#define int long long
#define N 100005
using namespace std;
int n,m,K;
int len;
int f[N];
pair<int,int> a[N],b[N],c[N];
signed main(){
    freopen("move.in","r",stdin);
    freopen("move.out","w",stdout);
    scanf("%lld %lld %lld",&n,&m,&K);
    for(int i=1;i<=n;i++) scanf("%lld %lld",&a[i].first,&a[i].second);
    for(int i=1;i<=m;i++) scanf("%lld %lld",&b[i].first,&b[i].second);
    for(int i=1;i<=n;i++){
        int z=0;
        for(int j=1;j<=n;j++){
            if(i==j) continue;
            if(a[j].first>=a[i].first&&a[j].second>=a[i].second){z=1;break;}
        }
        if(!z) c[++len]=a[i];
    }
    n=len;
    sort(c+1,c+n+1);
    for(int i=1;i<=n;i++) f[i]=1e16;
    for(int i=1;i<=n;i++){
        int l=c[i].first,r=c[i].second;
        for(int j=i;j>=1;j--){
            l=max(l,c[j].first),r=max(r,c[j].second);
            int z=1e16;
            for(int k=1;k<=m;k++) z=min(z,max(0ll,l-b[k].first)+max(0ll,r-b[k].second));
            f[i]=min(f[i],f[j-1]+z);
        }
    }
    printf("%lld\n",f[n]);
    return 0;
}